{% set pypi_name = 'python-ironicclient' %}
{% set upstream_version = upstream_version('4.4.0') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        Python API and CLI for OpenStack Ironic
License:        {{ license('Apache-2.0')}}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/{{ pypi_name }}
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('Babel') }}
BuildRequires:  {{ py3('PyYAML') }}
BuildRequires:  {{ py3('appdirs') }}
BuildRequires:  {{ py3('dogpile.cache') }}
BuildRequires:  {{ py3('fixtures') }}
BuildRequires:  {{ py3('jsonschema') }}
BuildRequires:  {{ py3('mock') }}
BuildRequires:  {{ py3('python-openstackclient') }}
BuildRequires:  {{ py3('osc-lib') }}
BuildRequires:  {{ py3('oslo.i18n') }}
BuildRequires:  {{ py3('oslo.utils') }}
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('pbr') }}
BuildRequires:  {{ py3('python-subunit') }}
BuildRequires:  {{ py3('requests') }}
BuildRequires:  {{ py3('requests-mock') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('testtools') }}
BuildArch:      noarch

%description
OpenStack Bare Metal Provisioning API Client Library

This is a client for the OpenStack Ironic API. It provides a Python API (the
ironicclient module) and a command-line interface (ironic).

%package -n python3-ironicclient
Summary: Python API and CLI for OpenStack Ironic
Requires:       {{ py3('PyYAML') }}
Requires:       {{ py3('appdirs') }}
Requires:       {{ py3('dogpile.cache') }}
Requires:       {{ py3('jsonschema') }}
Requires:       {{ py3('keystoneauth1') }}
Requires:       {{ py3('python-openstackclient') }}
Requires:       {{ py3('osc-lib') }}
Requires:       {{ py3('oslo.i18n') }}
Requires:       {{ py3('oslo.serialization') }}
Requires:       {{ py3('oslo.utils') }}
Requires:       {{ py3('pbr') }}
Requires:       {{ py3('requests') }}

%description -n python3-ironicclient
OpenStack Bare Metal Provisioning API Client Library.

This is a client for the OpenStack Ironic API. It provides a Python API (the
ironicclient module) and a command-line interface (ironic).

This package contains the Python 3.x module.

%package -n {{ py2name() }}-doc
Summary:        Documentation for OpenStack Ironic API Client
Group:          Documentation/HTML
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}
BuildRequires:  {{ py3('reno') }}
BuildRequires:  {{ py3('sphinxcontrib-apidoc') }}

%description -n {{ py2name() }}-doc
This is a client for the OpenStack Ironic API (Bare Metal. There's a
Python API (the ironicclient module), and a command-line script (ironic).
Each implements 100% of the OpenStack Ironic API.
This package contains auto-generated documentation.

%prep
%autosetup -p1 -n {{ pypi_name }}-{{ upstream_version }}
%py_req_cleanup

%build
%{py3_build}

PBR_VERSION={{ upstream_version }} %sphinx_build -b html doc/source doc/build/html
# remove the sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}

%install
%{py3_install}

%check
python3 -m stestr.cli run

%files -n python3-ironicclient
%license LICENSE
%doc README.rst
%{python3_sitelib}/ironicclient
%{python3_sitelib}/*.egg-info
%{_bindir}/baremetal

%files -n {{ py2name() }}-doc
%license LICENSE
%doc doc/build/html

%changelog
